package com.example.travel.utils;

import com.auth0.jwt.JWT;

import javax.servlet.http.HttpServletRequest;

/**
 * @Author : LinQingLiang
 * @file : UserInfoUtils.java
 * @Since : 2023/1/20 20:21
 */
public class UserInfoUtils {

    public static long getUserId(HttpServletRequest request){

        String token = request.getHeader("Authorization");
        Long id = Long.valueOf(JWT.decode(token).getAudience().get(0));
        return id;
    }

}